from socket import *
#tcp服务端开发
tcp_socket = socket(AF_INET,SOCK_STREAM)
tcp_socket.setsockopt(SOL_SOCKET,SO_REUSEADDR,True)
tcp_addr_port = ('',8080)
tcp_socket.bind(tcp_addr_port)
tcp_socket.listen(128)
client_socket,client_addr = tcp_socket.accept()
print(client_addr)
recv_data = client_socket.recv(1024)
print(f"客户端发来: {recv_data.decode('utf-8')}")
client_socket.close()
tcp_socket.close()